<template>
  <div class="header" @click="showDetial">
    <div class="content-wrap">
      <img class="avatar" :src="seller.avatar" />
      <div class="content">
        <div class="title">
          <span class="brand"></span>
          <span class="name">{{ seller.name }}</span>
        </div>
        <div class="description">
          {{ seller.description }}/{{ seller.deliveryTime }}分钟送达
        </div>
        <div class="supports" v-if="seller.supports">
          <support-ico :size="1" :type="seller.supports[0].type"></support-ico>
          <span class="text">{{ seller.supports[0].description }}</span>
        </div>
      </div>
      <div v-if="seller.supports" class="support-count">
        <span class="count">{{ seller.supports.length }}个</span>
        <span class="icon-keyboard_arrow_right"></span>
      </div>
    </div>
    <div class="bulletin-wrap">
      <span class="bulletin-title"></span>
      <span class="bulletin-text">{{ seller.bulletin }}</span>
      <i class="icon-keyboard_arrow_right"></i>
    </div>
    <div class="background">
      <img :src="seller.avatar" width="100%" height="100%" />
    </div>
    <!-- <div class="background-color"></div> -->
  </div>
</template>

<script>
import supportIco from 'common/icon/supportIco'

export default {
  name: 'HeaderText',
  props: {
    seller: Object
  },
  components: {
    supportIco
  },
  methods: {
    showDetial() {
      this.headerDetailComp =
        this.headerDetailComp ||
        this.$createHeaderDetail({
          $props: {
            seller: 'seller'
          }
        })
      this.headerDetailComp.show()
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '~styles/mixin.stylus';
@import '~styles/variable.stylus';

.header {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  color: rgb(255, 255, 255);
  background: rgba(7, 17, 27, 0.5);
}

.content-wrap {
  display: flex;
  position: relative;
  justify-content: center;
  align-items: center;
  padding: 24px 12px 18px 24px;

  .avatar {
    width: 64px;
    height: 64px;
    border-radius: 2px;
    margin-right: 16px;
  }

  .content {
    flex: 1;
    padding: 2px 0;

    .title {
      margin-bottom: 8px;

      .brand {
        vertical-align: top;
        display: inline-block;
        margin-right: 6px;
        width: 30px;
        height: 18px;
        bg-image('../img/brand');
        background-size: 30px 18px;
        background-repeat: no-repeat;
      }

      .name {
        font-size: 16px;
        font-weight: bold;
        line-height: 18px;
      }
    }

    .description {
      margin-bottom: 10px;
      font-size: 12px;
      font-weight: 200;
      line-height: 12px;
    }

    .supports {
      .support-ico {
        vertical-align: middle;
        margin-right: 4px;
      }

      .text {
        vertical-align: middle;
        font-size: 10px;
        font-weight: 200;
        line-height: 12px;
      }
    }
  }

  .support-count {
    position: absolute;
    right: 12px;
    bottom: 14px;
    padding: 0 8px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 14px;
    background-color: rgba(0, 0, 0, 0.2);

    .count {
      font-size: 10px;
      margin-right: 2px;
    }

    .icon-keyboard_arrow_right {
      line-height: 24px;
      font-size: 10px;
    }
  }
}

.bulletin-wrap {
  display: flex;
  align-items: center;
  height: 28px;
  line-height: 28px;
  background-color: rgba(7, 17, 27, 0.2);

  .bulletin-title {
    margin: 0 4px 0 12px;
    width: 22px;
    height: 12px;
    bg-image('../img/bulletin');
    background-size: 22px 12px;
    background-repeat: no-repeat;
  }

  .bulletin-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
  }
}

.background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  filter: blur(10px);
}

.background-color {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 17, 27, 0.5);
  z-index: -1;
}
</style>
